package com.example.system.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalTimeSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.List;

/**
 * <p>
 *
 * </p>
 *
 * @author 王鹤蒲
 * @since 2024-02-03
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
@TableName("sys_order")
@ApiModel(value = "Order对象", description = "")
public class Order implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty("ID")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @ApiModelProperty("订单号")
    private String orderNo;

    @ApiModelProperty("排班ID")
    private Integer appointmentSchedulerId;

    @ApiModelProperty("患者ID")
    private Integer patientId;

    @ApiModelProperty("预约时间")
    @JsonFormat(pattern = "HH:mm:ss", timezone = "GMT+8")
    @JsonSerialize(using = LocalTimeSerializer.class)
    @JsonDeserialize(using = LocalTimeDeserializer.class)
    private LocalTime appointmentTime;

    @ApiModelProperty("订单状态（'-1'：已取消，'0'：待支付，'1'：已支付，'2'：已叫号）")
    private String status;

    @ApiModelProperty("订单类型（'0'：挂号，'1'：充值）")
    private String type;

    @ApiModelProperty("订单金额")
    private Double amount;

    @ApiModelProperty("诊断书号")
    private String certificateNo;

    @ApiModelProperty("评分")
    private Integer rate;

    @ApiModelProperty("反馈")
    private String feedback;

    @ApiModelProperty("删除标志")
    private String delFlag;

    @ApiModelProperty("创建者")
    private String createBy;

    @ApiModelProperty("创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    private LocalDateTime createTime;

    @ApiModelProperty("更新者")
    private String updateBy;

    @ApiModelProperty("更新时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    private LocalDateTime updateTime;

    @ApiModelProperty("备注")
    private String remark;

    @TableField(exist = false)
    private AppointmentScheduler appointmentScheduler;

    @TableField(exist = false)
    private Patient patient;

    @TableField(exist = false)
    private MedicalCertificate medicalCertificate;

    @TableField(exist = false)
    private List<Payment> paymentList;
}
